import sys
import string

USER = 0
PID = 1
CPU = 2
MEM = 3
VSZ = 4
RSS = 5
TTY = 6
STAT = 7
START = 8
TIME = 9
COMMAND = 10

file = open(sys.argv[1], 'r')
content = file.readlines()
file.close()

csvFile = ""

for line in content:
	if line.find("USER") == -1:
		values = line.split();
		csvFile += values[CPU]+","+values[MEM]+","+values[START]+","+values[TIME]
		csvFile += "\n"
		
file = open(sys.argv[1].split(".")[0]+".csv", "w")
file.write(csvFile)
file.close()